﻿using System.Media;
using NMetronome;
namespace WindowsSound
{
	/// <summary>
	/// Implementation of IBeep using .NET System.Media 
	/// to play wav files
	/// No Thread needed, Player plays in an own Thread
	/// </summary>
	public class SystemMedia : IBeep
	{
		SoundPlayer highPlayer;
		SoundPlayer lowPlayer;

		string highFile = "high.wav";
		string lowFile = "low.wav";

		static SystemMedia()
		{
		}

		public SystemMedia()
		{
			highPlayer = new SoundPlayer(highFile);
			lowPlayer = new SoundPlayer(lowFile);
			highPlayer.LoadAsync();
			lowPlayer.LoadAsync();
		}

		public void BeepHigh()
		{
			highPlayer.Play();
		}

		public void BeepLow()
		{
			lowPlayer.Play();
		}

		public bool UsesOwnThread
		{
			get { return true; }
		}
	}
}
